#include<iostream>
#include<unistd.h>
#include <pthread.h>
using namespace std;

void *thread_run(void* args)
{
    while(1)
    {
        cout<<"i am a thread"<<endl;
        sleep(1);
    }
}
int main()
{
    cout<<"i am a main thread"<<endl;
    
    pthread_t tid;
    pthread_create(&tid,nullptr,thread_run,nullptr);
    sleep(3);

    cout<<"i am a main thread,i have exit"<<endl;

    pthread_exit(nullptr);

    return 0;
}